#include <stdio.h>
#include "../../src/gtthread.h"
#include <stdint.h>

char g_str[] = "hello world\n";

gtthread_t g_th1, g_th2;

gtthread_mutex_t g_mutex1;

void* worker(void* arg)
{
	volatile int k=0;
	gtthread_t th;
	int i;

	if((intptr_t)arg == 5)
		gtthread_exit(NULL);

	printf("thread %d\n", (intptr_t)arg);

	gtthread_create(&th, worker, (void*)(arg+1));
	gtthread_join(th, NULL);
}

int main()
{
	volatile int i=0;
	void* ret;
	gtthread_t th;

	gtthread_init(1000);

	gtthread_create(&th, worker, (void*)1);

	gtthread_join(th, NULL);
}
